﻿using System;
using System.Collections.Generic;

namespace _Indexer
{
    class Program
    {
        static void Main(string[] args)
        {
            Student student = new Student();
            List<string> students = new List<string>();
            students.Add("joey");
            students.Add("lisa");
            student.Students = students;
            var student_query = student["joey"];
            Console.WriteLine(student_query??"没有此学生");
        }

    }

    //Student类
    class Student
    {
        public string this[string _studentsName]
        {
            get
            {
                return Students.Find(d => d == _studentsName);
            }
        }
        public List<string> Students
        {
            get; set;
        }
    }
}
